package hcn.sync.annotation.action;

/**
 * Created by chase on 2016/11/14.
 */

public enum Action {
    saveData("00", "新增或者修改", "saveData"), addData("01", "新增", "addData"), removeData("02", "删除", "removeData"), updateData("03", "修改", "updateData");
    private String code;
    private String display;
    private String name;

    Action(String code, String display, String name) {
        this.code = code;
        this.name = name;
        this.display = display;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getDisplay() {
        return display;
    }

    public static Action get(String code) {
        for (Action cardType : values()) {
            if (cardType.getCode().equals(code)) {
                return cardType;
            }
        }
        return null;
    }

    public static String getDisplay(String code) {
        Action statusType = get(code);
        return statusType == null ? "" : statusType.getDisplay();
    }
}
